package day04;

import java.util.Arrays;

public class Chose {
    public static void main(String[] args) {
        int a [] = new int [10];
        for (int i = 0; i < a.length; i++) {
            a[i]= (int) (100*Math.random());

        }
        System.out.println(Arrays.toString(a));
        int max;
        int index;
        for (int i = 0; i <a.length-1; i++) {
            max = a[0];
            index=0;
            for (int j = 1; j <a.length-i; j++) {
                if (a[j]>max){
                    max = a[j];
                    index =j;
                }
            }
                a[index]=a[a.length-1-i];
                a[a.length-1-i]=max;
        }
        System.out.println(Arrays.toString(a));
    }
}
